package action;


import entity.Category;
import framework.bean.factory.ObjectFactory;
import framework.mvc.annotation.Action;
import framework.mvc.annotation.Controller;
import framework.mvc.annotation.Result;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import service.RoomService;

import java.util.List;

@Controller
@Action(path = "/room")
public class RoomAction {

    @Action(path = "/findCategories",results = @Result(path = "/WEB-INF/page/roomPrice.jsp"))
    public String findCategories(HttpServletRequest request, HttpServletResponse response){
        RoomService roomService= (RoomService) ObjectFactory.getObject("roomService");

        List<Category> categories=roomService.findCategories();

        request.setAttribute("categories",categories);

        return "success";
    }
}
